<?php
set_time_limit(0);
require_once("lib/IXR_Library.php.inc");
 
$client->debug = true; // Set it to fase in Production Environment
 
// Create the client object
$client = new IXR_Client('http://localhost/wpamazon/xmlrpc.php');
 
 $username = "admin"; 
 $password = "1234"; 
 $params = array(0,$username,$password,10); // Last Parameter tells how many posts to fetch
 
// Run a query To Read Posts From Wordpress
if (!$client->query('metaWeblog.getRecentPosts', $params)) {
    die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());
}
 // Update a Selected Post
 $title= "Updated Title"; // The Title of the Post
 $bodycontent="Updated Blog Article Content"; // Article Content
 $categoriesu= array('Category1', 'Category2'); // Pre Existing Categories - Updated
 $tagsu="tag1, tag2, $tag3"; // Updated Tags
 //$customfields=array('id'=>'1238','key'=>'Author-bio Ping X', 'value'=>'Autor Bio Here Ping X');
 
 //$customfields=array('id'=>'1238','key'=>'Author-bio Ping X', 'value'=>'Autor Bio Here Ping X');
 //$customfields=array(array('id'=>'1238','key'=>'Author-bio Ping X','value'=>'Autor Bio Here Ping X'),'id'=>'1242','key'=>'awprasin','value'=>'555555555555');
//$customfields=array(array('key'=>'A','value'=>'Autor Bio Here Ping X'),'key'=>'B','value'=>'555555555555','key'=>'C','value'=>'777777777','key'=>'D','value'=>'Autor Bio Here Ping X','key'=>'E','value'=>'555555555555','key'=>'F','value'=>'777777777');

//$customfields=array('key'=>'A','value'=>'Autor Bio Here Ping X');


$customfields = array(  
 	                      array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' ),
							array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' ),
							array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' ),
							array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' ),
							array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' ),
							array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' ),
							array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' ),
							array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' ),
							array( 'key' => 'city', 'value' => 'Sacramento' ),
  							array( 'key' => 'city', 'value' => 'Sandy' )
							

 	                       );  


 
/* 'custom_fields' => {
       { "key" => "height", "value" => 500 },
       { "key" => "width", "value" => 750 }
     }*/
 $content = array('title'=>$title, 
				  'description'=>$bodycontent,
				  'categories'=>$categoriesu,
				  'mt_keywords'=>$tagsu, 
				  'custom_fields' => $customfields
				  );
 
 $params = array(259,$username,$password,$content,1); // First Parameter is mandatory Post Id (get your post id via Recent Blogs entries)

 
// Run a query for PHP
if (!$client->query('metaWeblog.editPost', $params)) {
    die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());
}else{ echo 'Update SuccessFul'; }
 
?>